# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pymiproxy
pkgname=('python2-pymiproxy' 'python-pymiproxy')
_pkgname=pymiproxy
pkgver=1.0
pkgrel=7
pkgdesc='Micro Interceptor Proxy - a simple MITM HTTP/S proxy.'
arch=('any')
url='https://pypi.org/project/pymiproxy/#files'
license=('GPL')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('0218697cb00908f928079890ca93a5b5e31fd7d90194c52501bbb28260d80863daac66fd234f6f930d484f3a96b924975c6fed8b43f9987d66fe2e23f53ade4c')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pymiproxy() {
  depends=('python2' 'python2-pyopenssl')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-pymiproxy() {
  depends=('python' 'python-pyopenssl')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

